<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
use Hash;
//导入校验请求类
// use App\Http\Requests\LoginRequest;
class ShopController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    

    //主页
    public function index(){
    	$shop = DB::table('shop_shop')
    					->get();
        return view("Home.Shop.index", ['shop' => $shop]);
    }
    //添加
    public function add(Request $request){
         
    	return view("Home.Shop.add");
    	 
    }
    
    // 处理添加
    public function doadd(Request $request)
    {
       $data = $request->only(['shopname','shop_link']);

       if($data){
             DB::table('shop_shop')
                   ->insert($data);
                   return redirect('/h_shop');
               }else{
                 return redirect('/h_s_add')->with('error','添加失败');
               }
    }

}
